#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int count(int k)
{
	int sum = 0;
	for (int i = 1; i < k; i++)
		if (k % i == 0)
			sum += i;

	return sum;
}

int game(int x, int y)
{
	if ((x == count(y)) && (y == count(x)))
		return 1;
	else
		return 0;
}

int main()
{
	int m, n;
	scanf("%d %d", &m, &n);

	if (game(m, n))
		printf("YES");
	else
		printf("NO");
	return 0;
}